// Copyright Jamie Iles, 2017
//
// This file is part of s80x86.
//
// s80x86 is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// s80x86 is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with s80x86.  If not, see <http://www.gnu.org/licenses/>.

#pragma once

struct keydef {
    unsigned short normal;
    unsigned short shifted;
    unsigned short ctrl;
    unsigned short alt;
};

static const struct keydef keycode_map[] = {
        [0x1E] = {0x1E61, 0x1E41, 0x1E01, 0x1E00},
        [0x30] = {0x3062, 0x3042, 0x3002, 0x3000},
        [0x2E] = {0x2E63, 0x2E43, 0x2E03, 0x2E00},
        [0x20] = {0x2064, 0x2044, 0x2004, 0x2000},
        [0x12] = {0x1265, 0x1245, 0x1205, 0x1200},
        [0x21] = {0x2166, 0x2146, 0x2106, 0x2100},
        [0x22] = {0x2267, 0x2247, 0x2207, 0x2200},
        [0x23] = {0x2368, 0x2348, 0x2308, 0x2300},
        [0x17] = {0x1769, 0x1749, 0x1709, 0x1700},
        [0x24] = {0x246A, 0x244A, 0x240A, 0x2400},
        [0x25] = {0x256B, 0x254B, 0x250B, 0x2500},
        [0x26] = {0x266C, 0x264C, 0x260C, 0x2600},
        [0x32] = {0x326D, 0x324D, 0x320D, 0x3200},
        [0x31] = {0x316E, 0x314E, 0x310E, 0x3100},
        [0x18] = {0x186F, 0x184F, 0x180F, 0x1800},
        [0x19] = {0x1970, 0x1950, 0x1910, 0x1900},
        [0x10] = {0x1071, 0x1051, 0x1011, 0x1000},
        [0x13] = {0x1372, 0x1352, 0x1312, 0x1300},
        [0x1F] = {0x1F73, 0x1F53, 0x1F13, 0x1F00},
        [0x14] = {0x1474, 0x1454, 0x1414, 0x1400},
        [0x16] = {0x1675, 0x1655, 0x1615, 0x1600},
        [0x2F] = {0x2F76, 0x2F56, 0x2F16, 0x2F00},
        [0x11] = {0x1177, 0x1157, 0x1117, 0x1100},
        [0x2D] = {0x2D78, 0x2D58, 0x2D18, 0x2D00},
        [0x15] = {0x1579, 0x1559, 0x1519, 0x1500},
        [0x2C] = {0x2C7A, 0x2C5A, 0x2C1A, 0x2C00},
        [0x02] = {0x0231, 0x0221, 0x0231, 0x7800},
        [0x03] = {0x0332, 0x0340, 0x0300, 0x7900},
        [0x04] = {0x0433, 0x0423, 0x0433, 0x7A00},
        [0x05] = {0x0534, 0x0524, 0x0534, 0x7B00},
        [0x06] = {0x0635, 0x0625, 0x0635, 0x7C00},
        [0x07] = {0x0736, 0x075E, 0x071E, 0x7D00},
        [0x08] = {0x0837, 0x0826, 0x0837, 0x7E00},
        [0x09] = {0x0938, 0x092A, 0x0938, 0x7F00},
        [0x0A] = {0x0A39, 0x0A28, 0x0a39, 0x8000},
        [0x0B] = {0x0B30, 0x0B29, 0x0b30, 0x8100},
        [0x0C] = {0x0C2D, 0x0C5F, 0x0C1F, 0x8200},
        [0x0D] = {0x0D3D, 0x0D2B, 0x0d2b, 0x8300},
        [0x1A] = {0x1A5B, 0x1A7B, 0x1A1B, 0x1A00},
        [0x1B] = {0x1B5D, 0x1B7D, 0x1B1D, 0x1B00},
        [0x27] = {0x273B, 0x273A, 0x273b, 0x2700},
        [0x28] = {0x2827, 0x2822, 0x2827, 0x2827},
        [0x29] = {0x2960, 0x297E, 0x2960, 0x2960},
        [0x2B] = {0x2B5C, 0x2B7C, 0x2B1C, 0x2600},
        [0x33] = {0x332C, 0x333C, 0x332c, 0x332c},
        [0x34] = {0x342E, 0x343E, 0x342e, 0x342e},
        [0x35] = {0x352F, 0x353F, 0x352f, 0x352f},
        [0x3B] = {0x3B00, 0x5400, 0x5E00, 0x6800},
        [0x3C] = {0x3C00, 0x5500, 0x5F00, 0x6900},
        [0x3D] = {0x3D00, 0x5600, 0x6000, 0x6A00},
        [0x3E] = {0x3E00, 0x5700, 0x6100, 0x6B00},
        [0x3F] = {0x3F00, 0x5800, 0x6200, 0x6C00},
        [0x40] = {0x4000, 0x5900, 0x6300, 0x6D00},
        [0x41] = {0x4100, 0x5A00, 0x6400, 0x6E00},
        [0x42] = {0x4200, 0x5B00, 0x6500, 0x6F00},
        [0x43] = {0x4300, 0x5C00, 0x6600, 0x7000},
        [0x44] = {0x4400, 0x5D00, 0x6700, 0x7100},
        [0x85] = {0x8500, 0x8700, 0x8900, 0x8B00},
        [0x86] = {0x8600, 0x8800, 0x8A00, 0x8C00},
        [0x0E] = {0x0E08, 0x0E08, 0x0E7F, 0x0E00},
        [0x1C] = {0x1C0D, 0x1C0D, 0x1C0A, 0xA600},
        [0x01] = {0x011B, 0x011B, 0x011B, 0x0100},
        [0x39] = {0x3920, 0x3920, 0x3920, 0x3920},
        [0x0F] = {0x0F09, 0x0F00, 0x9400, 0xA500},

        [0x53] = {0x5300, 0x532E, 0x9300, 0xA300},
        [0x50] = {0x5000, 0x5032, 0x9100, 0xA000},
        [0x4F] = {0x4F00, 0x4F31, 0x7500, 0x9F00},
        [0x47] = {0x4700, 0x4737, 0x7700, 0x9700},
        [0x52] = {0x5200, 0x5230, 0x9200, 0xA200},
        [0x4B] = {0x4B00, 0x4B34, 0x7300, 0x9B00},
        [0x51] = {0x5100, 0x5133, 0x7600, 0xA100},
        [0x49] = {0x4900, 0x4939, 0x8400, 0x9900},
        [0x4D] = {0x4D00, 0x4D36, 0x7400, 0x9D00},
        [0x48] = {0x4800, 0x4838, 0x8D00, 0x9800},
};
